Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@adonisjs/fold
Advanced tools
Dependency manager and ioc container for your next NodeJs application
Dependency manager and IoC container for Node.js
Fold is a dependency manager for Node.js used by AdonisJs framework. Below is the list of features.
fakes
when writing tests.You can install the package from npm.
npm i --save adonis-fold
const { ioc } = require('adonis-fold')
class Foo {
}
ioc.bind('App/Foo', function () {
return new Foo()
})
const foo = ioc.use('App/Foo')
// return Foo class instance
ioc.with('App/Foo', (Foo) => {
// Only if App/Foo exists
})
Simple enough! But we do not see the real power of the Ioc container, since we can instantiate the class manually too. Right? NO
Here are the following benefits.
The author of the Foo
class can decide how to instantiate the class and return a properly configured instance, instead of leaving it to the consumer.
While you are making use of the Ioc container, one binding can be dependent upon others, without much work. For example
class Foo {
constructor (config) {
//
}
}
ioc.bind('App/Foo', function (app) {
const config = app.use('App/Config')
return new Foo(config)
})
const foo = ioc.use('App/Foo')
This time, we injected App/Config
behind the scenes and the consumer of the Foo
class won't have to worry about passing the config manually.
Checkout the official documentation at the AdonisJs website for more info.
Tests are written using japa. Run the following commands to run tests.
npm run test:local
# report coverage
npm run test
# on windows
npm run test:win
Checkout CHANGELOG.md file for release history.
AdonisJs – @adonisframework – virk@adonisjs.com
Checkout LICENSE.txt for license information
Harminder Virk (Aman) - https://github.com/thetutlage
FAQs
A simple and straight forward implementation for IoC container in JavaScript
The npm package @adonisjs/fold receives a total of 34,038 weekly downloads. As such, @adonisjs/fold popularity was classified as popular.
We found that @adonisjs/fold demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.